<%@ page import="java.util.List" %>
<%@ page import="com.book.pojo.Order" %>
<%@ page import="java.util.Iterator" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的订单</title>

    <%-- 静态包含 base标签、css样式、jQuery文件 --%>
    <%@ include file="/pages/common/head.jsp" %>


    <style type="text/css">
        h1 {
            text-align: center;
            margin-top: 200px;
        }
    </style>
</head>
<body>

<div id="header">
    <a href="index.jsp"><img class="logo_img" alt="" src="static/img/logo.gif"></a>
    <span class="wel_word">我的订单</span>

    <%--静态包含，登录 成功之后的菜单 --%>
    <%@ include file="/pages/common/login_success_menu.jsp" %>


</div>

<div id="main">

    <table>

        <tr>
            <td>日期</td>
            <td>金额</td>
            <td>状态</td>
            <td>详情</td>
        </tr>

        <%
            List<Order> list = (List<Order>) request.getAttribute("orders");

            System.out.println(list);
//				Iterator iterator = list.iterator();
//				while(iterator.hasNext()){
//					System.out.println(iterator.next());
//				}
        %>

        <c:if test="${empty requestScope.orders}">
            <%--如果订单空的情况--%>
            <tr>
                <td colspan="4"><a href="index.jsp">亲，订单为空！快跟小伙伴们去浏览商品吧！！！</a></td>
            </tr>
        </c:if>
        <c:if test="${not empty requestScope.orders}">
            <%--如果订单非空的情况--%>

            <c:forEach items="${requestScope.orders}" var="o">
                <tr>
                    <td>${o.createTime}</td>
                    <td>${o.price}</td>
                    <td><c:choose>
                        <c:when test="${o.status == 0}">未发货</c:when>
                        <c:when test="${o.status == 1}">已发货</c:when>
                        <c:when test="${o.status == 2}">已签收</c:when>
                    </c:choose></td>
                    <td><a href="orderServlet?action=detail&id=${o.orderId}" target="_blank">查看详情</a></td>
                </tr>
            </c:forEach>
        </c:if>

    </table>


</div>


<%--静态包含页脚内容--%>
<%@include file="/pages/common/footer.jsp" %>


</body>
</html>